try:
    f = open('test.txt', 'r')
except:
    f = open('test.txt', 'w')
finally:
    f.close()
